package cn.sciento.boot.api.customize.compile;

import java.io.IOException;
import java.net.URI;
import javax.tools.JavaFileObject;
import javax.tools.SimpleJavaFileObject;

public class StringSource extends SimpleJavaFileObject {
  private final String contents;
  
  public StringSource(String className, String contents) {
    super(URI.create("string:///" + className.replace('.', '/') + Kind.SOURCE.extension), Kind.SOURCE);
    this.contents = contents;
  }
  
  public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
    return this.contents;
  }
}
